﻿


using System;
using System.Collections.Generic;
using System.Collections;
using System.Runtime.Serialization;

namespace MF.HSD.CreateVoucherBP
{
	/// <summary>
	/// 凭证集合 DTO :自定义的数据传输类型 
	/// 
	/// </summary>
	public  partial class VoucherDTO  : UFSoft.UBF.Business.DTOBase
	{
		#region Constructor
		
		/// <summary>
		/// Constructor
		/// </summary>
		public VoucherDTO(){
			initData();
		}
		private void initData()
		{
		
		
		
		
					TotalMoney = 0m; 
					Diction = 0; 

		}

		#endregion
		
		#region Properties
			/// <summary>
		/// OrgCode (该属性可为空,且无默认值)
		/// 凭证集合.Misc.OrgCode
		/// </summary>
		/// <value>System.String</value>
		public System.String OrgCode
		{
			get	
			{	
				return (System.String)base.GetValue("OrgCode",typeof(System.String));
			}

			 set	
			{
				base.SetValue("OrgCode",value);
			}
		}
				/// <summary>
		/// VoucherNo (该属性可为空,且无默认值)
		/// 凭证集合.Misc.VoucherNo
		/// </summary>
		/// <value>System.String</value>
		public System.String VoucherNo
		{
			get	
			{	
				return (System.String)base.GetValue("VoucherNo",typeof(System.String));
			}

			 set	
			{
				base.SetValue("VoucherNo",value);
			}
		}
				/// <summary>
		/// VoucherLineDTO (该属性可为空,且无默认值)
		/// 凭证集合.Misc.VoucherLineDTO
		/// </summary>
		/// <value></value>
		public List<MF.HSD.CreateVoucherBP.VoucherLineDTO> VoucherLineDTO
		{
			get	
			{	
				return (List<MF.HSD.CreateVoucherBP.VoucherLineDTO>)base.GetValue("VoucherLineDTO",typeof(List<MF.HSD.CreateVoucherBP.VoucherLineDTO>));
			}

			 set	
			{
				base.SetValue("VoucherLineDTO",value);
			}
		}
				/// <summary>
		/// ToOrgCode (该属性可为空,且无默认值)
		/// 凭证集合.Misc.ToOrgCode
		/// </summary>
		/// <value>System.String</value>
		public System.String ToOrgCode
		{
			get	
			{	
				return (System.String)base.GetValue("ToOrgCode",typeof(System.String));
			}

			 set	
			{
				base.SetValue("ToOrgCode",value);
			}
		}
				/// <summary>
		/// TotalMoney (该属性可为空,但有默认值)
		/// 凭证集合.Misc.TotalMoney
		/// </summary>
		/// <value>System.Decimal</value>
		public System.Decimal TotalMoney
		{
			get	
			{	
				return (System.Decimal)base.GetValue("TotalMoney",typeof(System.Decimal));
			}

			 set	
			{
				base.SetValue("TotalMoney",value);
			}
		}
				/// <summary>
		/// Diction (该属性可为空,但有默认值)
		/// 凭证集合.Misc.Diction
		/// </summary>
		/// <value>System.Int32</value>
		public System.Int32 Diction
		{
			get	
			{	
				return (System.Int32)base.GetValue("Diction",typeof(System.Int32));
			}

			 set	
			{
				base.SetValue("Diction",value);
			}
		}
		
		#endregion	
		#region Multi_Fields
						
		#endregion 

		#region ModelResource
		/// <summary>
		/// 凭证集合的显示名称资源--已经废弃，不使用.
		/// </summary>
		public string Res_TypeName {	get {return "" ;}	}
		/// <summary>
		/// OrgCode的显示名称资源 -- 已经废弃，不使用.
		/// </summary>
		public string Res_OrgCode　{ get { return "";　}　}
		/// <summary>
		/// VoucherNo的显示名称资源 -- 已经废弃，不使用.
		/// </summary>
		public string Res_VoucherNo　{ get { return "";　}　}
		/// <summary>
		/// VoucherLineDTO的显示名称资源 -- 已经废弃，不使用.
		/// </summary>
		public string Res_VoucherLineDTO　{ get { return "";　}　}
		/// <summary>
		/// ToOrgCode的显示名称资源 -- 已经废弃，不使用.
		/// </summary>
		public string Res_ToOrgCode　{ get { return "";　}　}
		/// <summary>
		/// TotalMoney的显示名称资源 -- 已经废弃，不使用.
		/// </summary>
		public string Res_TotalMoney　{ get { return "";　}　}
		/// <summary>
		/// Diction的显示名称资源 -- 已经废弃，不使用.
		/// </summary>
		public string Res_Diction　{ get { return "";　}　}
		#endregion 




		#region EntityData exchange
		
		#region  Do SerializeKey -ForDTOType
		//反序化Key到Data的ID中　－－由FromEntityData自动调用，不处理层次关系
		private void DeSerializeKey(VoucherDTOData data)
		{
		






		}

		#endregion 
		
		/// <summary>
		/// Copy Entity From EntityData
		/// </summary>
		public void FromEntityData(VoucherDTOData data)
		{
			this.FromEntityData(data,new Hashtable());
		}
		//used by ubf..
		public void FromEntityData(VoucherDTOData data,IDictionary dict)
		{
			if (data == null)
				return;
			if (dict == null ) dict = new Hashtable() ;
			dict[data] = this;
			DeSerializeKey(data);
		
			this.OrgCode = data.OrgCode;

			this.VoucherNo = data.VoucherNo;

	
			if (data.VoucherLineDTO != null)
			{	
				List<MF.HSD.CreateVoucherBP.VoucherLineDTO> listVoucherLineDTO = new List<MF.HSD.CreateVoucherBP.VoucherLineDTO>();
				foreach(MF.HSD.CreateVoucherBP.VoucherLineDTOData obj in data.VoucherLineDTO ){

					MF.HSD.CreateVoucherBP.VoucherLineDTO child = dict[obj] as MF.HSD.CreateVoucherBP.VoucherLineDTO;
					if (child == null)
					{
						child = new MF.HSD.CreateVoucherBP.VoucherLineDTO();
						child.FromEntityData(obj,dict);
					}
					//值对象应该是依赖主创建的.但此处可能不是.
					listVoucherLineDTO.Add(child);
				
				}
				this.VoucherLineDTO = listVoucherLineDTO;
			}

			this.ToOrgCode = data.ToOrgCode;

			this.TotalMoney = data.TotalMoney;

			this.Diction = data.Diction;

		}

		/// <summary>
		/// Create EntityData From Entity
		/// </summary>
		public VoucherDTOData ToEntityData()
		{
			return ToEntityData(null,new Hashtable());
		}
		/// <summary>
		/// Create EntityData From Entity - used by ubf 
		/// </summary>
		public VoucherDTOData ToEntityData(VoucherDTOData data, IDictionary dict){
			if (data == null)
				data = new VoucherDTOData();
			if (dict == null ) 
				dict = new Hashtable() ;
			else
            {
                if (dict.Contains(this))
                {
                    data = (VoucherDTOData)dict[this];
                    return data;
                }
            }
			dict[this] = data;
		
			data.OrgCode = this.OrgCode;

			data.VoucherNo = this.VoucherNo;

	
			if (this.VoucherLineDTO != null)
			{	
				List<MF.HSD.CreateVoucherBP.VoucherLineDTOData> listVoucherLineDTO = new List<MF.HSD.CreateVoucherBP.VoucherLineDTOData>();
				foreach(MF.HSD.CreateVoucherBP.VoucherLineDTO obj in this.VoucherLineDTO ){
					if (obj==null) continue ;

					MF.HSD.CreateVoucherBP.VoucherLineDTOData old = dict[obj] as MF.HSD.CreateVoucherBP.VoucherLineDTOData;
					listVoucherLineDTO.Add((old != null) ? old : obj.ToEntityData(null,dict));
				
				}
				data.VoucherLineDTO = listVoucherLineDTO;
			}

			data.ToOrgCode = this.ToOrgCode;

			data.TotalMoney = this.TotalMoney;

			data.Diction = this.Diction;

			return data ;
		}

		#endregion	
	}	
	
}